package cn.edu.ctbu.dp07.dao;

import cn.edu.ctbu.dp07.entity.Student;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;

import java.util.List;

public interface StudentDao extends JpaRepository<Student, Integer> {
    // 根据姓名查询学生
    List<Student> findByNameContaining(String name);
    
    // 根据学号查询学生
    Student findByStudentNo(String studentNo);
    
    // 根据姓名或学号查询学生
    @Query("SELECT s FROM tb_student s WHERE s.name LIKE %:keyword% OR s.studentNo LIKE %:keyword%")
    List<Student> findByNameOrStudentNoContaining(@Param("keyword") String keyword);
} 